#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ll long long
#define stoorz_and_QuantAsk using
#define AK namespace
#define IOI_and_Jayun_is_stupid std

stoorz_and_QuantAsk AK IOI_and_Jayun_is_stupid;

const int N = 0;

inline ll Read()
{
	ll x = 0, f = 1;
	char c = getchar();
	while (c != '-' && (c < '0' || c > '9')) c = getchar();
	if (c == '-') f = -f, c = getchar();
	while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + c - '0', c = getchar();
	return x * f;
}

int n, L, R;

int main()
{
	freopen("candy.in", "r", stdin);
	freopen("candy.out", "w", stdout);
	n = Read(), L = Read(), R = Read();
	int kl = L / n, kr = R / n;
	if (kr > kl) printf ("%d\n", n - 1);
	else printf ("%d\n", R % n);
	return 0;
}
